package com.hd.trans.ui.base

import android.view.View
import androidx.fragment.app.Fragment
import com.hd.trans.framework.click.XClickUtil
import com.hd.trans.network.bean.TransSubsection

abstract class BaseFragment: Fragment(), View.OnClickListener {
    open fun onBackPressed(): Boolean {
        return false
    }

    open fun onContentChange(taskId: String) {}
    open fun displaySubsection(data: TransSubsection) {}
    open fun onRotateChanged(isRotate: Boolean) {}
    open fun onChronometerTickListener(durationMillis: Long) {}
    open fun onStateChange() {}
    open fun onDevicesConnect(isConnect: Boolean) {}

    /**
     * 快速点击
     */
    protected open fun onFastClick(v: View?){}

    /**
     * 不允许快速点击
     */
    protected open fun onViewClick(v: View?){}

    override fun onClick(v: View?) {
        onFastClick(v)
        if (XClickUtil.isFastDoubleClick(v, XClickUtil.INTERVAL_MILLIS.toLong())) {
            return
        }
        onViewClick(v)
    }
}